//实例化 
//连接接口


class my_agent extends uvm_agent ;

   `uvm_component_utils(my_agent)
   function new(string name="my_agent", uvm_component parent=null);
    super.new(name, parent);
  endfunction

   my_sequencer  sqr;
   my_driver     drv;
   my_monitor    mon;
   //uvm_analysis_port #(my_transaction)  ap;
   uvm_blocking_put_port#(my_transaction) info_data_put_port;

   extern virtual function void build_phase(uvm_phase phase);
   extern virtual function void connect_phase(uvm_phase phase);
endclass

function void my_agent::build_phase(uvm_phase phase);
   super.build_phase(phase);

   //A_port = new("ap", this);

   if (is_active == UVM_ACTIVE) begin
      sqr = my_sequencer::type_id::create("sqr", this);
      drv = my_driver::type_id::create("drv", this);
   end
   mon = my_monitor::type_id::create("mon", this);
endfunction

function void my_agent::connect_phase(uvm_phase phase);
   super.connect_phase(phase);

    if(is_active == UVM_ACTIVE)begin
        drv.seq_item_port.connect(sqr.seq_item_export);
    end

   //ap = mon.ap;
   info_data_put_port = mon.info_data_put_port;
endfunction



class my_agent_out extends uvm_agent ;
   `uvm_component_utils(my_agent_out)

   function new(string name="my_agent_out", uvm_component parent=null);
    super.new(name, parent);
  endfunction


   my_monitor_out    o_mon;

   uvm_blocking_get_export#(my_transaction_code) code_data_get_export;

   extern virtual function void build_phase(uvm_phase phase);
   extern virtual function void connect_phase(uvm_phase phase);


endclass


function void my_agent_out::build_phase(uvm_phase phase);
   super.build_phase(phase);


   o_mon = my_monitor_out::type_id::create("o_mon", this);

   code_data_get_export = new("code_data_get_export", this);
endfunction

function void my_agent_out::connect_phase(uvm_phase phase);
   super.connect_phase(phase);

   code_data_get_export.connect(o_mon.code_data_get_imp);
   
endfunction


